package com.foreknow.elmboot.controller;


import com.foreknow.elmboot.po.Business;
import com.foreknow.elmboot.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController

@RequestMapping("/BusinessController")
public class BusinessController {

    @Autowired
    private BusinessService businessService;

    /**
     * 根据orderTypeId查询商家的信息
     * @param orderTypeId
     * @return
     */
    @PostMapping("/listBusinessByOrderTypeId")
    public Object getBusinessOrderTypeId(Integer orderTypeId) {
        //调用service的方法
        List<Business> list = businessService.getBusinessOrderTypeId(orderTypeId);
        return list;
    }

    /**
     * 根据businessId查询某一个商家信息
     * @param businessId
     * @return
     */
    @PostMapping("/getBusinessById")
    public Object getBusinessById(Integer businessId) {
        //调用service的方法
        return businessService.getBusinessById(businessId);
    }


}
